package sv.gob.mh.dgii.dao.config;

import javax.sql.DataSource;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement
@Profile("desa")
public class PersistenceHibernateConfigDesa {

    Log logger = LogFactory.getLog(PersistenceHibernateConfigDesa.class);

    @Bean
    public DataSource dataSource() {
        return getDesa();
    }

    @Bean
    public DataSource dataSourceReports() {
        return dataSource();
    }

    public DataSource getDesa() {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver");
        dataSource.setUrl("jdbc:oracle:thin:@172.16.1.46:1521:SIIT");
        dataSource.setUsername("SERVINTEGRA");
        dataSource.setPassword("newusrserv2013inte");
        logger.info("DESAROLLO>dataSource: " + dataSource);
        return dataSource;
    }

}
